<template>
	<view>
		<view class="">匹配成功</view>
		<view class="match_b">
			<view class="match_b_x">
				<u-avatar :src="newData.selfInfo.images"></u-avatar>
				{{newData.selfInfo.username}}
			</view>
			vs
			<view class="match_b_s">
				<u-avatar :src="newData.opponentInfo.images"></u-avatar>
				{{newData.opponentInfo.username}}
			</view>
		</view>

		<span>{{ count }}秒后跳转答题页</span>

		<!-- <u-line-progress :percentage="30" :showText="false"></u-line-progress> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				count: '',
				newData: {}


			}
		},
		onLoad(params) {
			
			this.newData = JSON.parse(decodeURIComponent(params.data))
			this.goChoicePeople()

		},
		methods: {
			goChoicePeople() {
				const TIME_COUNT = 5
				if (!this.timer) {
					this.count = TIME_COUNT
					this.show = false
					this.timer = setInterval(() => {
						if (this.count > 0 && this.count <= TIME_COUNT) {
							this.count--
						} else {
							this.show = true
							clearInterval(this.timer)
							this.timer = null
							// 跳转到选人加分界面
							uni.navigateTo({
								url: '../../rellyRank/rellyRank?data='+encodeURIComponent( JSON.stringify(this.newData))
							})
						}
					}, 1000)
				}
			}
		}
	}
</script>

<style scoped lang="scss">
	.match_b {
		height: 300rpx;
		background-color: pink;
		margin: 50rpx;
		border-radius: 10rpx;
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-content: space-around;
		padding-top: 50rpx;
		width: 90%;
		text-align: center;
		line-height: 150rpx;

		.match_b_x {

			width: 150rpx;
			height: 150rpx;
			background-color: skyblue;
			border-radius: 50%;
			text-align: center;
			line-height: 150rpx;
			margin-right: 30px;


		}

		.match_b_s {

			margin-left: 30px;
			width: 150rpx;
			height: 150rpx;
			background-color: orange;
			border-radius: 50%;
			text-align: center;
			line-height: 150rpx;
		}

	}
</style>
